package com.liefox.serviceedu.controller.front;

import com.liefox.commonutils.R;
import com.liefox.serviceedu.entity.EduCourse;
import com.liefox.serviceedu.entity.EduTeacher;
import com.liefox.serviceedu.service.EduCourseService;
import com.liefox.serviceedu.service.EduTeacherService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author zjh
 * @Date 2021/7/19 下午 12:58
 **/
@RestController
@RequestMapping("/serviceedu/indexfront")
//@CrossOrigin
public class IndexFrontController {

    @Autowired
    private EduTeacherService teacherService;
    @Autowired
    private EduCourseService courseService;

    @ApiOperation(value = "查询前八条热门课程和前四条名师")
    @GetMapping("index")
    public R index() {

        final List<EduCourse> list = courseService.listC();
        final List<EduTeacher> list2 = teacherService.listT();

        return R.ok().data("clist", list).data("tlist", list2);
    }

}
